<form name="$ctrl.redeployGitForm" class="form-horizontal my-8">
  <div class="col-sm-12 form-section-title"> Redeploy from git repository </div>
  <git-form-info-panel
    class-name="text-muted small"
    url="$ctrl.model.URL"
    type="stack"
    config-file-path="$ctrl.model.ConfigFilePath"
    additional-files="$ctrl.stack.AdditionalFiles"
  ></git-form-info-panel>

  <git-form-auto-update-fieldset model="$ctrl.formValues.AutoUpdate" on-change="($ctrl.onChangeAutoUpdate)"></git-form-auto-update-fieldset>
  <div class="form-group">
    <div class="col-sm-12">
      <p>
        <a class="small interactive" ng-click="$ctrl.state.showConfig = !$ctrl.state.showConfig">
          <i ng-class="{ 'fa fa-minus space-right': $ctrl.state.showConfig, 'fa fa-plus space-right': !$ctrl.state.showConfig }" aria-hidden="true"></i>
          {{ $ctrl.state.showConfig ? 'Hide' : 'Advanced' }} configuration
        </a>
      </p>
    </div>
  </div>
  <git-form-ref-field ng-if="$ctrl.state.showConfig" value="$ctrl.formValues.RefName" on-change="($ctrl.onChangeRef)"></git-form-ref-field>
  <git-form-auth-fieldset
    ng-if="$ctrl.state.showConfig"
    is-edit="$ctrl.state.isEdit"
    model="$ctrl.formValues"
    on-change="($ctrl.onChange)"
    show-auth-explanation="true"
  ></git-form-auth-fieldset>
  <environment-variables-panel
    ng-model="$ctrl.formValues.Env"
    explanation="These values will be used as substitutions in the stack file"
    on-change="($ctrl.onChangeEnvVar)"
  ></environment-variables-panel>

  <button
    class="btn btn-sm btn-primary"
    ng-click="$ctrl.submit()"
    ng-disabled="$ctrl.isSubmitButtonDisabled() || $ctrl.state.hasUnsavedChanges || !$ctrl.redeployGitForm.$valid"
    style="margin-top: 7px; margin-left: 0"
    button-spinner="$ctrl.state.redeployInProgress"
    analytics-on
    analytics-event="docker-stack-pull-redeploy"
    analytics-category="docker"
  >
    <span ng-hide="$ctrl.state.redeployInProgress"> <i class="fa fa-sync space-right" aria-hidden="true"></i> Pull and redeploy </span>
    <span ng-show="$ctrl.state.redeployInProgress">In progress...</span>
  </button>

  <button
    class="btn btn-sm btn-primary"
    ng-click="$ctrl.saveGitSettings()"
    ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.state.hasUnsavedChanges || !$ctrl.redeployGitForm.$valid"
    style="margin-top: 7px; margin-left: 0"
    button-spinner="$ctrl.state.inProgress"
    analytics-on
    analytics-event="docker-stack-update-git-settings"
    analytics-category="docker"
    analytics-properties="$ctrl.buildAnalyticsProperties()"
  >
    <span ng-hide="$ctrl.state.inProgress"> Save settings </span>
    <span ng-show="$ctrl.state.inProgress">In progress...</span>
  </button>
</form>
